<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="__ADMIN__/css/font.css">
    <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
    <script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
    <style>
        .layui-btn+.layui-btn{
            margin-left: 0;
        }
        .layui-table td, .layui-table th
        {
            min-width: 50px !important;
        }
        .layui-btn-xs {
            height: 22px !important;
            line-height: 22px !important;
            padding: 0 5px !important;
            font-size: 12px;
        }
    </style>
</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>{$nav}</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon layui-icon-refresh-3" style="line-height:30px"></i></a>
</div>
<div class="x-body x-admin">

    <xblock style="display: flex;">

        <div class="layui-card-body" style="padding-left: 0;float:left;padding-left:20px;padding-top:0;">
            <form class="layui-form layui-col-space5" action="" method="get">
                <div class="layui-inline layui-show-xs-block">
                    <input style="width:260px;" type="text" name="keyword" id="keyword" value="{:input()['keyword']}" placeholder="设备型号，设备编号，负责人" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-inline layui-show-xs-block">
                    <button class="layui-btn" id="search-btn">搜索</button>
                </div>
            </form>
        </div>
    </xblock>

    <div class="layui-table-body layui-table-main" style="width: 100%;min-height:0;">
        <table class="layui-table layui-form" lay-filter="liveDetail" id="liveDetail"> </table>
    </div>
</div>

<script type="text/html" id="do-td">
    <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="view">详情</a>
    <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>

<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <button class="layui-btn" onclick="x_admin_show('添加固定资产','{:url('archiveManage/fixedAssetAdd')}','','650','750')">
            添加固定资产
        </button>
    </div>
</script>

<script>
    layui.use(['form','layer','jquery','table','util','laydate'], function(){
        form = layui.form,
        layer = layui.layer
        ,$ = layui.jquery
        ,table = layui.table
        ,util = layui.util
        ,laydate = layui.laydate;

        table.render({
            elem: '#liveDetail'
            ,url:'{:url('admin/archiveManage/fixedAssetManagement')}?keyword={:input('keyword')}'
                ,toolbar: '#toolbarDemo'
                ,defaultToolbar: ['filter', 'exports', 'print']
                ,limit: 50
                ,height: $(window).height()-150
                ,title: '固定资产管理表'
                ,cols: [[
                    {field:'id', width:80,title:"序号",fixed: 'left' },
        //            {width:80,title:"部门",fixed: 'left',toolbar:'#department_name'},
                    {field:'department_name', width:80,title:"部门",fixed: 'left' },
                    {field:'device_name', title:"设备名称",fixed: 'left', width:110 },
                    {field:'device_type_num', width:180,title:"设备型号",fixed: 'left' },
                    {field:'device_num', width:110,title:"设备编号",fixed: 'left' },
                    {field:'enable_time_date', width:180,title:"启用时间",fixed: 'left'},
                    {field:'belong_to_personal', width:100,title:"负责人",fixed: 'left'},
                    {field:'remarks',title:"备注"},
                    {width:180,title:"操作", toolbar: '#do-td'}
                ]]
            ,page: true
        });

    table.on('tool(liveDetail)', function(obj){
        var data = obj.data;
        if(obj.event == 'del'){
            layer.confirm('确认要删除吗？',function(index){
                $.ajax({
                    type:'POST',
                    dataType:'json',
                    data:{id:data.id},
                    url:"{:url('archiveManage/fixedAssetDel')}",
                    success:function(o){
                        layer.msg(o.msg,{icon:o.icon,time:1000});
                        obj.del();
                    }
                });
            });
        }else if(obj.event == 'view'){
            x_admin_show('固定资产详情','{:url('archiveManage/fixedAssetView')}/id/'+data.id,'','650','750')
        } else if(obj.event == 'edit'){
            x_admin_show('固定资产修改','{:url('archiveManage/fixedAssetAdd')}/id/'+data.id,'','650','750')
        }
    });

    });

</script>
</body>

</html>